﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AimGameLibrary.GameObject
{
    public class GameBoolean : GameBaseValue
    {
        Boolean myboolean;
        public Boolean MybooleaN { get { myboolean = (Boolean)GetParentValue(); return myboolean; } set { myboolean = value; SetParentValue(myboolean); } }

        public override void LoadData(Identification getdata, int IndexData, NodeData node)
        {
            InputMode = (NodeInputMode)getdata.Items.GetValue(IndexData + 1);
            if (InputMode == NodeInputMode.Boolean_1)
                Listnameparent.Add(node.Data);
            else MybooleaN = (Boolean)getdata.Items.GetValue(IndexData + 2);
        }

        protected override object GetParentValue()
        {
            if (this.Listparent.Count > 0)
            {
                if (InputMode == NodeInputMode.Boolean_1
                    && Listparent[0].GetType() == typeof(GameBoolean))
                    return ((GameBoolean)Listparent[0]).MybooleaN;
                else return myboolean;
            }
            else return myboolean;
        }

        protected override void SetParentValue(object obj)
        {
            if (this.Listparent.Count > 0)
                if (InputMode == NodeInputMode.Boolean_1)
                    if (Listparent[0].GetType() == typeof(GameBoolean))
                        ((GameBoolean)Listparent[0]).MybooleaN = (Boolean)obj;
        }
    }
}
